//消息反射
postOffice := Object clone
postOffice packageSender := method(call sender)
postOffice messageTarget := method(call target)
postOffice messageArgs := method(call message arguments)
postOffice messageName := method(call message name)

mailer := Object clone
mailer deliver := method(postOffice packageSender)

mailer deliver //deliver
postOffice messageTarget //postOffice
postOffice messageArgs("one", 2, :three)
postOffice messageName

//Also supported are Smalltalk style ifTrue, ifFalse, ifNil and ifNonNil methods:
//(y < 10) ifTrue(x := y) ifFalse(x := 2)
unless := method(
    (call sender doMessage(call message argAt(0))) ifFalse(
    call sender doMessage(call message argAt(1))) ifTrue(
    call sender doMessage(call message argAt(2)))
)
//The doMessage() method evaluates the argument in the context of the receiver.
//unless需要三个参数 unless是个消息
unless(1 == 2,write("One is not two\n"), write("One is two\n"))

Object ancestors := method(
    prototype := self proto
    if(prototype != Object,
    writeln("Slots of ", prototype type, "\n---------")
    prototype slotNames foreach(slotName, writeln(slotName))
    writeln
    prototype ancestors)
)
Animal := Object clone
Animal speak := method("animal noise" printIn)
Duck := Animal clone
Duck speak := method("quack" printIn)
Duck walk := method("waddle" printIn)
disco := Duck clone
disco ancestors